package com.example.springboot.utils;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;

public class SqlString {
    public static String replaceLike(String str){
        if(StringUtils.isNotBlank(str)){
            if(str.contains("\\") || str.contains("%") || str.contains("_")||str.contains(";")){
                String replaceStr = str.replace("\\", "\\\\");
                String replaceStr2 = replaceStr.replace("%", "\\%");
                String replaceStr3 = replaceStr2.replace("_", "\\_");
                return replaceStr3.replace(";", "");
            }
        }
        return str;
    }
}
